class StudentController < ApplicationController
  def index
    @students = Student.all
   
    respond_to do |format|
      format.html  # index.html.erb
      format.json  { render :json => @students }
    end
  end

  def new
    @student = Student.new
   
    respond_to do |format|
      format.html  # new.html.erb
      format.json  { render :json => @student }
    end
  end

  def create
    @student = student.new(params[:student])
   
    respond_to do |format|
      if @student.save
        format.html  { redirect_to(@student,
                      :notice => 'student was successfully created.') }
        format.json  { render :json => @student,
                      :status => :created, :location => @student }
      else
        format.html  { render :action => "new" }
        format.json  { render :json => @student.errors,
                      :status => :unprocessable_entity }
      end
    end
  end
end
